package com.noble.glamour.module.local.chat.msgtype;

import com.noble.glamour.module.local.chat.msgtype.bean.BaseMessage;
import com.noble.glamour.module.local.chat.msgtype.type.CommonMessage;
import com.noble.glamour.module.local.chat.msgtype.type.GiftMessage;
import com.noble.glamour.module.local.chat.msgtype.type.InviteVideoMessage;
import com.noble.glamour.module.local.chat.msgtype.type.MaxVersionMessage;
import com.noble.glamour.module.local.chat.msgtype.type.SysNoticeMessage;
import com.noble.glamour.module.local.chat.msgtype.type.TextMessage;
import com.noble.glamour.module.local.chat.msgtype.type.VideoMessage;
import com.noble.mail.MessageConstant;

/**
 * 消息类型
 */
public enum BaseMessageType {
    // 最新定义消息
    common(CommonMessage.class, 900),//文本消息

    // 旧消息
    hi(CommonMessage.class, 3),//打招呼
    gift(GiftMessage.class, 10),//礼物消息
    hint(TextMessage.class, 14),//小提示消息   不显示
    html(TextMessage.class, 19),//html消息
    wantGift(GiftMessage.class, 20),//索要礼物消息
    video(VideoMessage.class, 24),//视频消息
    htmlText(TextMessage.class, 25),//HTML文本消息
    autoUpdateHtml(TextMessage.class, 28),//自动升级提示
    sysNotice(SysNoticeMessage.class, 29),//系统通知消息
    inviteVideoMass(InviteVideoMessage.class, 30),//女性对男性的语音（视频）邀请

    maxVersion(MaxVersionMessage.class, 1000000),//最大版本消息 1000000这个不要随便改
    ;

    public Class<? extends BaseMessage> msgClass = null;
    public int msgType;

    BaseMessageType(Class<? extends BaseMessage> msgClass, int msgType) {
        this.msgClass = msgClass;
        this.msgType = msgType;
    }

    public static BaseMessageType valueOf(int msgType) {
        if (MessageConstant.isMaxVersionMsg(msgType)) {
            return BaseMessageType.maxVersion;
        }

        for (BaseMessageType messageType : BaseMessageType.values()) {
            if (messageType.getMsgType() == msgType) {
                return messageType;
            }
        }
        return null;
    }

    public int getMsgType() {
        return this.msgType;
    }


    // ================================== 消息类型，特殊地方方便用 ===========================================
    public static final int Follow_MsgType = 5;//关注
    public static final int System_MsgType = 7;//系统消息
    public static final int RedEnvelopesBalance_MsgType = 17;//红包余额变动消息
    public static final int video_MsgType = 24;//视频消息
    public static final int inviteVideoDelivery_MsgType = 30;//女性对男性的群发语音(视频)邀请
    public static final int Recved_MsgType = 1001;//送达消息
    public static final int Alone_Invite_Video_MsgType = 1003;//女用户单独视频邀请
    public static final int VIDEOCHAT_FACEU__MsgType = 1004;  //视频聊天中的道具消息
    public static final int VIDEOCHAT_COMPLAIN__MsgType = 1005;//视频聊天中的投诉消息
}
